<?php

namespace catchAdmin\smstag\tables\forms;


use catchAdmin\smstopic\model\SmsTopic;
use catcher\library\form\Form;

class SmsTag extends Form
{
    protected $table = 'sms_tag';

    public function fields(): array
    {
        // TODO: Implement fields() method.
        return [
            self::hidden("deleted_at", "0"),
            self::select('sms_topic_id', '所属主题')
                ->col(self::col(12))->options(
                    SmsTopic::field(['id as value', 'title as label'])->select()->toArray()
                )->clearable(true)->filterable(true),
            self::input('title', '标签名称')->required()->maxlength(100)->col(13)->placeholder("标签名称请在@@中配置，例如@患者姓名@"),

            self::radio('type', '标签类型')->value(1)->options(
                self::options()->add('动态字段', 1)->add('固定内容', 2)->add("患者数据源", 3)->render()
            ),
            self::input('mapping_field', '对应字段')->required()->maxlength(100)->col(13),
        ];
    }
}